﻿//-----------------------------------------------------------------------
// <copyright file="ThreadEntity.cs" company="CodePlex">
//     Copyright (c) Doug Holland, CodePlex. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace CodePlex.Diagnostics.Model
{
    using System;

    using CodePlex.Diagnostics.Contracts;

    /// <summary>
    /// Represents an operating system thread.
    /// </summary>
    public sealed partial class ThreadEntity
    {
        #region public ThreadEntity()

        /// <summary>
        /// Initializes a new instance of the <see cref="T:ThreadEntity"/> class.
        /// </summary>
        public ThreadEntity()
        {
        }

        #endregion

        #region public ThreadEntity(Thread Thread)

        /// <summary>
        /// Initializes a new instance of the <see cref="T:ThreadEntity"/> class.
        /// </summary>
        /// <param name="thread">An instance of the <see cref="T:ThreadDataContract"/> class to be used to construct an instance of the <see cref="T:ThreadEntity"/> class.</param>
        public ThreadEntity(ThreadDataContract thread)
        {
            this.CurrentCulture = thread.CurrentCulture;

            this.CurrentUICulture = thread.CurrentUICulture;

            this.IsAlive = thread.IsAlive;

            this.IsBackground = thread.IsBackground;

            this.IsThreadPoolThread = thread.IsThreadPoolThread;

            this.ManagedThreadId = thread.ManagedThreadId;

            this.Name = thread.Name;

            this.Priority = thread.Priority.ToString();

            this.ThreadState = thread.ThreadState.ToString();
        }

        #endregion
    }
}
